﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
dim listid,id
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)

		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)
if sid="Null" then
Response.Redirect "/login.asp?sid=" & sidd & "&url=/bbs/viewv.asp?id="&id&"@@listid="&listid
Response.end
end if
IF Request.QueryString("Action")="login" Then
	call loginn
else
	call index
end if
end Function

Function index
dim listid,id,tid,file_rs,sql,name,size
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)
tid=Request.QueryString("tid")
		if not isnumeric(tid) then tid=0
		if tid="" then tid=0
		tid=clng(tid)
		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)
                
select case v
case "0"
we0="<br/>"
hr="-------------<br/>"
%>
<card title="下载论坛资源"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>下载论坛资源</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%

End Select
			Set file_rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select [name],[size] from [qingtian_bbs_forum_file]  where id="&tid&" order by [id] asc"
			file_rs.Open Sql,conn,1,1
			if not (file_rs.bof and file_rs.eof)  then
		name=file_rs("name")
		size=file_rs("size")
else
qingtian.err("没有该附件")
			end if
			file_rs.close
			set file_rs=nothing
%>
<%=qingtian.qingsav("64")%>
<%=dao%>=下载论坛资源=<%=we0%><%=we%>
资源名称:<%=zi%><%=qingtian.utf8(name)%>(大小:<%=int(size/1000000)+1%>kb)<%=zi0%><br/>
<%if qingtian.vip(qingtian.nid)="VIP会员" then%>
你好,由于你是本站VIP会员可以免费下载此资源,
<%else%>
我的可用<%=qingtian.bi%>:<%=zi%><%=conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")%><%=zi0%><br/>
下载本资源需<%=qingtian.confff("bii")%><%=qingtian.bi%>,其中<%=int(qingtian.confff("bii")/2)%><%=qingtian.bi%>为上传者所得(<%=zi%>成为VIP会员，可以终身免币下载，还可享受更多特权<%=zi0%>),
<%end if%>
确定要下载吗？
<a href='downfile.asp?Action=login&amp;listid=<%=listid%>&amp;id=<%=id%>&amp;tid=<%=tid%>&amp;sid=<%=sidd%>'>是的</a>|<a href='viewv.asp?listid=<%=listid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>取消</a><%=we0%><%=sou%>
如果您觉得本附件对您有用，请下载后认真回帖支持上传者,谢谢<%=we0%>
<%=qingtian.qingsav("65")%>
<%=sou%><a href='viewv.asp?listid=<%=listid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>返回上级</a><%=we0%>

<%
End Function

Function loginn
dim listid,id,name,tid,strr,strrr,sql,rs,file_rs,url,nid
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)
tid=Request.QueryString("tid")
		if not isnumeric(tid) then tid=0
		if tid="" then tid=0
		tid=clng(tid)
		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)
select case v
case "0"
we0="<br/>"
hr="-------------<br/>"
%>
<card title="下载论坛资源"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>下载论坛资源</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%

End Select

			Set file_rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select [url] from [qingtian_bbs_forum_file]  where id="&tid&" order by [id] asc"
			file_rs.Open Sql,conn,1,1
			if not (file_rs.bof and file_rs.eof)  then
		url=file_rs("url")
else
qingtian.err("没有该附件")
			end if
			file_rs.close
			set file_rs=nothing
if qingtian.vip(qingtian.nid)="VIP会员" then
errss=1
else
If conn.execute("select vip from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("vip")=true Then Response.Redirect url
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select top 1 nid,name from qingtian_bbs_forum where listid="&listid&" and lock<>True and id="&id
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof)  then
        nid=rs("nid")
        name=rs("name")
If conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")<qingtian.confff("bii") Then 
                        Tip="出错了！你的"&qingtian.bi&"不够哦！"
                        errss=0
                        else
                        qingtian.payy("-"&qingtian.confff("bii"))
                        qingtian.pay int(qingtian.confff("bii")/2),nid
strr=""&qingtian.nid&"tt你好,你浏览的帖子(url=/bbs/viewv.asp?id="&id&"&listid="&listid&"&sid=[sid])"&name&"(/url)附件下载成功,系统自动扣除你"&qingtian.confff("bii")&""&qingtian.bi&"!"
strrr=""&nid&"tt你好,你发表的帖子(url=/bbs/viewv.asp?id="&id&"&listid="&listid&"&sid=[sid])"&name&"(/url)附件被下载,系统自动为你增加"&qingtian.confff("bii")&""&qingtian.bi&"!"
qingtian.addnfo(strr)
qingtian.addnfo(strrr)
                        end if

        else
                        Tip="出错了！你下载的帖子附件不存在或帖子已经锁定！"
                        errss=0

        end if
	Rs.close
	set rs=nothing
end if
if errss<>"0" then
Response.Redirect url
else
Response.Write we&tip&we0
%>
<%=sou%><a href='viewv.asp?listid=<%=listid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>返回上级</a><%=we0%>
<%

end if
end function
%>